var e = require;
var t = module;
var n = exports;
("use strict");
var o,
  i =
    (this && this.__extends) ||
    ((o = function (e, t) {
      return (o =
        Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array &&
          function (e, t) {
            e.__proto__ = t;
          }) ||
        function (e, t) {
          for (var n in t)
            Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
        })(e, t);
    }),
    function (e, t) {
      function n() {
        this.constructor = e;
      }
      o(e, t),
        (e.prototype =
          null === t
            ? Object.create(t)
            : ((n.prototype = t.prototype), new n()));
    }),
  r =
    (this && this.__decorate) ||
    function (e, t, n, o) {
      var i,
        r = arguments.length,
        y =
          r < 3
            ? t
            : null === o
            ? (o = Object.getOwnPropertyDescriptor(t, n))
            : o;
      if ("object" == typeof Reflect && "function" == typeof Reflect.decorate)
        y = Reflect.decorate(e, t, n, o);
      else
        for (var a = e.length - 1; 0 <= a; a--)
          (i = e[a]) &&
            (y = (r < 3 ? i(y) : 3 < r ? i(t, n, y) : i(t, n)) || y);
      return 3 < r && y && Object.defineProperty(t, n, y), y;
    };
Object.defineProperty(n, "__esModule", { value: !0 });
var y,
  a = e("EventConst"),
  s = e("PopupConst"),
  c = e("SceneConst"),
  x = e("UserConst"),
  l = e("EffectManager"),
  h = e("EventManager"),
  d = e("PopupManager"),
  u = e("SceneManager"),
  f = e("UserManager"),
  t = cc._decorator,
  e = t.ccclass,
  t = t.property,
  e =
    ((y = cc.Component),
    i(p, y),
    (p.prototype.onEnable = function () {
      this.initEvent(), this.initView();
    }),
    (p.prototype.onDisable = function () {
      this.clearEvent();
    }),
    (p.prototype.initView = function () {
      var e = cc.sys.localStorage.getItem("walkFast_key");
      (e = null == e || "" == e ? 1 : e) <= 0 && (e = 0),
        f.User.set(x.UserData.KEY, Number(e)),
        (this.key.string = "" + e);
    }),
    (p.prototype.initEvent = function () {
      h.Event.on(a.default.KEY_UPDATE, this.changeKey, this),
        h.Event.on(a.default.KEY_EFFECT, this.keyEffect, this);
    }),
    (p.prototype.clearEvent = function () {
      h.Event.off(a.default.KEY_UPDATE, this.changeKey, this),
        h.Event.off(a.default.KEY_EFFECT, this.keyEffect, this);
    }),
    (p.prototype.changeKey = function () {
      var e = f.User.get(x.UserData.KEY);
      this.key.string = "" + e;
    }),
    (p.prototype.keyEffect = function () {
        console.log('keyeffect'),
      l.Effect.showEffect(1, this.icon, 1);
    }),
    (p.prototype.clickSelf = function () {
      cc.game.emit("playClickAudio"),
        u.Scene.getCurrentScene() == c.SceneConst.MAIN
          ? cc.game.emit("gamelog", "btn005")
          : u.Scene.getCurrentScene() == c.SceneConst.GAME &&
            cc.game.emit("gamelog", "btn020"),
        d.Popup.show(s.PopupConst.SHOP);
    }),
    r([t(cc.Node)], p.prototype, "icon", void 0),
    r([t(cc.Label)], p.prototype, "key", void 0),
    r([e], p));
function p() {
  var e = (null !== y && y.apply(this, arguments)) || this;
  return (e.icon = null), (e.key = null), e;
}
n.default = e;
